package com.dhcc.core.framework.constant.state;

/**
 * 权限主体类型的枚举
 * 
 * @ClassName: PermPrincipalType
 * @Description: TODO
 * @author: cyf
 * @date: 2018年1月2日 上午9:17:04
 */
public enum PermPrincipalType {

    // 角色
    ROLE(1, "角色"),
    // 部门
    DEPT(2, "部门"),
    // 用户
    USER(3, "用户");

    int code;
    String name;

    PermPrincipalType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String valueOf(Integer status) {
        if (status == null) {
            return "";
        } else {
            for (PermPrincipalType s : PermPrincipalType.values()) {
                if (s.getCode() == status) {
                    return s.getName();
                }
            }
            return "";
        }
    }
}
